extends HBoxContainer


onready var item_op = $ItemSelect 
onready var ratio_input = $SpinBox 
# 所处区域，可以有多个区域
onready var field_area = $FieldArea

func _ready():
	# 获取区域分布
	field_area.add_item(str("全部"),-1)
	for i in DataSource.get_data_list(DataSource.map_sprite_area):
		field_area.add_item(str(i["id"], " ", i["areaDesc"]),i["id"])
	

func set_data(data):
	if data:
		item_op.set_value(data["itemId"])
		ratio_input.value = data["ratio"]
		var index = field_area.get_item_index(data.get("fieldPokemonArea",-1))
		field_area.select(index)


func get_data():
	return {
		"itemId": item_op.get_value(),
		"ratio": ratio_input.value,
		"fieldPokemonArea":field_area.get_selected_id()
	}


func _on_Button_pressed():
	queue_free()
	pass # Replace with function body.
